using System;

namespace Coding4Fun.BoxingBots.Common
{
	public class MovementDescriptorPacket : GamePacket
	{
		public double Move { get; set; }
		public double Strafe { get; set; }
		public double Rotate { get; set; }
		public bool PunchLeft { get; set; }
		public bool PunchRight { get; set; }
		public bool PopHead { get; set; }
		public int Health { get; set; }

		public override void ReadPacket(System.IO.BinaryReader br)
		{
			Move = br.ReadDouble();
			Strafe = br.ReadDouble();
			Rotate = br.ReadDouble();
			PunchLeft = br.ReadBoolean();
			PunchRight = br.ReadBoolean();
			PopHead = br.ReadBoolean();
			Health = br.ReadInt32();
		}

		public override void WritePacket(System.IO.BinaryWriter bw)
		{
			bw.Write(Move);
			bw.Write(Strafe);
			bw.Write(Rotate);			
			bw.Write(PunchLeft);
			bw.Write(PunchRight);
			bw.Write(PopHead);
			bw.Write(Health);
		}

		public override string ToString()
		{
			return string.Format(
				"Move: {0}" + Environment.NewLine +
				"Strafe: {1}" + Environment.NewLine +
				"Rotate: {2}" + Environment.NewLine +
				"PunchLeft: {3}" + Environment.NewLine +
				"PunchRight: {4}" + Environment.NewLine +
				"PopHead: {5}" + Environment.NewLine + 
				"Health: {6}" + Environment.NewLine,
				Move, Strafe, Rotate, PunchLeft, PunchRight, PopHead, Health);
		}
	}
}